package org.shoukaiseki.springbootdemowsdlserver.wsdl.config;

import org.shoukaiseki.springbootdemowsdlserver.wsdl.service.CallService;
import org.shoukaiseki.springbootdemowsdlserver.wsdl.service.PlaceService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import javax.xml.ws.Endpoint;

/**
 * @author vhukze
 * @date 2022/4/12 14:57
 */
@Configuration
public class WebServiceConfig {

    public static final String targetNamespace="http://impl.service.wsdl.springbootdemowsdlserver.shoukaiseki.org/";

    @Resource
    private PlaceService placeService;

    @Resource
    private CallService callService;

    @Value("${webs.ip-port}")
    private String webs;

    @Bean
    public Endpoint endpoint() {
        String url = "http://" + webs + "/webService";
        System.out.println("服务发布//");
        return Endpoint.publish(url, placeService);
    }

    @Bean
    public Endpoint endpoint2() {
        String url = "http://" + webs + "/wsdl";
        System.out.println("服务发布//");
        return Endpoint.publish(url, callService);
    }
}
